
package com.eltonkent.security;

public class BFEncryptionEngine
{
	private final byte[] key = "A!N@D#R$O%I&D*4*D(FUTURE".getBytes();
	private final BlowfishCrypto bfProvider;
	private static BFEncryptionEngine instance;

	public static BFEncryptionEngine getInstance()
	{
		if(instance == null)
			instance = new BFEncryptionEngine();
		return instance;
	}

	private BFEncryptionEngine()
	{
		bfProvider = new BlowfishCrypto();
	}

	public byte[] decrypt(byte[] cipher)
	{
		bfProvider.init(false, key);
		return bfProvider.decrypt(cipher);
	}

	public byte[] encrypt(byte[] plain)
	{
		bfProvider.init(true, key);
		return bfProvider.encrypt(plain);
	}
}
